package com.aop;

import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.aop.ThrowsAdvice;

import javax.sql.DataSource;
import java.lang.reflect.Method;

/**
 * @author xiangjun.deng
 * email 17670934918dxj@sina.com
 * @date 2021/8/12 9:35
 * @desc
 */
public class TxAdvice01 implements MethodBeforeAdvice, AfterReturningAdvice,ThrowsAdvice {
    public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
        System.out.println("after returning");
        System.out.println(returnValue);
    }

    public void before(Method method, Object[] args, Object target) throws Throwable {
        System.out.println("before advisor...运行了");
        System.out.println(method);
        System.out.println(target);
    }
     public void afterThrowing(Exception ex)
     {
         System.out.println(ex.getMessage());
     }

}
